package com.wgchao.pharmacymg.application.mapstruct.mapper.vo;

import com.wgchao.pharmacymg.Infrastructure.menus.DslMenu;
import com.wgchao.pharmacymg.application.mapstruct.dto.PhDrugStorageDTO;
import com.wgchao.pharmacymg.application.vo.DrugStorageSave;
import com.wgchao.pharmacymg.application.vo.DrugStorageVO;
import com.wgchao.pharmacymg.application.vo.mapper.PhDrugStorageVoMapper;
import com.wgchao.pharmacymg.application.vo.mapper.PhDrugStorageVoSAVEMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName: DrugStorageSaveMapper
 * @author: wgchao
 * @createTime: 2019/11/18 10:51 AM
 * @Description: TODO
 */
@Component
public class DrugStorageVDMapper {
    @Autowired
    private PhDrugStorageVoSAVEMapper drugStorageVoSAVEMapper;
    @Autowired
    private PhDrugStorageVoMapper drugStorageVoMapper;

    public PhDrugStorageDTO toDTO(DrugStorageSave drugStorageSave){
        PhDrugStorageDTO drugStorageDTO = drugStorageVoSAVEMapper.toDTO(drugStorageSave);
        //TODO 设置药库分类
        return drugStorageDTO;
    }

    public DrugStorageVO toVO(PhDrugStorageDTO drugStorageDTO){
        DrugStorageVO drugStorageVO = drugStorageVoMapper.toEntity(drugStorageDTO);
        drugStorageVO.setDslName(DslMenu.getName(drugStorageVO.getDsl()));
        return drugStorageVO;
    }

}
